package top.zerozoo.learn.grade.enums;

public enum Sex {
    NONE(0,"未知"),
    MALE(1,"男"),
    FEMALE(2,"女");

    private int number;
    private String localized;

    Sex(int number, String localized){
        this.number = number;
        this.localized = localized;
    }

    public int getNumber() {
        return number;
    }

    public String toString(){
        return this.localized;
    }
    public static Sex parse(Integer number){
        if(number == null){
            number = 0;
        }
        switch (number){
            case 1:
                return MALE;
            case 2:
                return FEMALE;
            default:
                return NONE;
        }
    }

}
